package com.association.controller;

import com.association.model.PageDrawingBo;
import com.association.model.ResultResp;
import com.association.model.entity.PageData;
import com.association.model.entity.WebPage;
import com.association.model.entity.WebProject;
import com.association.model.vo.WebProjectVo;
import com.association.service.WebPageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author 18244
 */
@RestController
@RequestMapping("/WebPage")
public class WebPageController {
    @Resource
    WebPageService webPageService;

    @ApiOperation(value = "轮询")
    @PostMapping("/pageList")
    public ResultResp pageList(@RequestBody WebPage webPage) {
        return webPageService.pages(webPage);
    }

    @ApiOperation(value = "查询集合")
    @PostMapping("/getList")
    public ResultResp getList(@RequestBody WebPage webPage) {
        return webPageService.getList(webPage);
    }

    @ApiOperation(value = "id查询")
    @PostMapping("/getById")
    public ResultResp getById(@RequestBody WebPage webPage) {
        return webPageService.getById(webPage);
    }

    @ApiOperation(value = "查询问卷数据")
    @PostMapping("/getByDate")
    public ResultResp getByDate(@RequestBody WebPage webPage) {
        return webPageService.getByDate(webPage);
    }

    @ApiOperation(value = "填写问卷数据")
    @PostMapping("/addData")
    public ResultResp addData(@RequestBody PageData pageData) {
        return webPageService.addData(pageData);
    }

    @ApiOperation(value = "修改")
    @PostMapping("/edit")
    @ResponseBody
    public ResultResp edit(@RequestBody WebPage webPage) {
        return new ResultResp(webPageService.edit(webPage));
    }

    @ApiOperation(value = "添加")
    @PostMapping("/add")
    public ResultResp add(@RequestBody WebPage webPage) {
        return new ResultResp(webPageService.add(webPage));
    }

    @ApiOperation(value = "删除")
    @PostMapping("/delete")
    public ResultResp delete(@RequestBody WebPage webPage) {
        return new ResultResp(webPageService.delete(webPage));
    }

    @ApiOperation(value = "显示模板组件")
    @PostMapping("/composingShow")
    public ResultResp composingShow(@RequestBody WebPage webPage) {
        return webPageService.composingShow(webPage);
    }

    @ApiOperation(value = "更新组件属性")
    @PostMapping("/WebModule/ModuleUpdate")
    public ResultResp ModuleUpdate(@RequestBody WebPage webPage) {
        return webPageService.composingUpdate(webPage);
    }

    @ApiOperation(value = "更新组件属性")
    @PostMapping("/WebModule/saveDrawingList")
    public ResultResp saveDrawingList(@RequestBody PageDrawingBo pageDrawingBo) {
        return webPageService.saveDrawingList(pageDrawingBo);
    }
}
